//
//  MYProgressHUD.m
//  Sampux
//
//  Created by rzm on 16/9/20.
//  Copyright © 2016年 rzm. All rights reserved.
//

#import "MYProgressHUD.h"

@implementation MYProgressHUD
+ (SVProgressHUD*)sharedView {
    static dispatch_once_t once;
    
    static SVProgressHUD *sharedView;
#if !defined(SV_APP_EXTENSIONS)
    dispatch_once(&once, ^{ sharedView = [[self alloc] initWithFrame:[[[UIApplication sharedApplication] delegate] window].bounds]; });
#else
    dispatch_once(&once, ^{ sharedView = [[self alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; });
#endif
    return sharedView;
}

+ (void)showErrorWithStatus:(NSString*)status {
    
    
    
}


+ (void)showImage:(UIImage*)image status:(NSString*)status {
    NSTimeInterval displayInterval = [self displayDurationForString:status];
//    [[self sharedView] showImage:image status:status duration:displayInterval];
}
//
//- (void)showImage:(UIImage*)image status:(NSString*)status duration:(NSTimeInterval)duration {
//    __weak SVProgressHUD *weakSelf = self;
//    [[NSOperationQueue mainQueue] addOperationWithBlock:^{
//        __strong SVProgressHUD *strongSelf = weakSelf;
//        if(strongSelf){
//            // Update / Check view hierachy to ensure the HUD is visible
//            [strongSelf updateViewHierachy];
//            
//            // Reset progress and cancel any running animation
//            strongSelf.progress = SVProgressHUDUndefinedProgress;
//            [strongSelf cancelRingLayerAnimation];
//            [strongSelf cancelIndefiniteAnimatedViewAnimation];
//            
//            // Update imageView
//            UIColor *tintColor = strongSelf.foregroundColorForStyle;
//            UIImage *tintedImage = image;
//            if([strongSelf.imageView respondsToSelector:@selector(setTintColor:)]) {
//                if (tintedImage.renderingMode != UIImageRenderingModeAlwaysTemplate) {
//                    tintedImage = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
//                }
//                strongSelf.imageView.tintColor = tintColor;
//            } else {
//                tintedImage = [strongSelf image:image withTintColor:tintColor];
//            }
//            strongSelf.imageView.image = tintedImage;
//            strongSelf.imageView.hidden = NO;
//            
//            // Update text
//            strongSelf.statusLabel.text = status;
//            
//            // Show
//            [strongSelf showStatus:status];
//            
//            // An image will dismissed automatically. Therefore we start a timer
//            // which then will call dismiss after the predefined duration
//            strongSelf.fadeOutTimer = [NSTimer timerWithTimeInterval:duration target:strongSelf selector:@selector(dismiss) userInfo:nil repeats:NO];
//            [[NSRunLoop mainRunLoop] addTimer:strongSelf.fadeOutTimer forMode:NSRunLoopCommonModes];
//        }
//    }];
//}


@end
